package com.tsunami.authority.entity.auth;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.time.LocalDateTime;

/**
 * @author lx
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@ToString(callSuper = true)
@Accessors(chain = true)
@TableName("oauth_client_details")
@Schema(description = "授权客户端")
public class Clients {

    @Schema(description = "客户端唯一ID")
    @TableField(value = "client_id")
    private String clientId;

    @Schema(description = "资源id集合")
    @TableField(value = "resource_ids")
    private String resourceIds;

    @Schema(description = "客户端唯一ID")
    @TableField(value = "client_secret")
    private String clientSecret;

    @Schema(description = "权限范围")
    @TableField(value = "scope")
    private String scope;

    @Schema(description = "客户端支持的grant_type")
    @TableField(value = "authorized_grant_types")
    private String authorizedGrantTypes;

    @Schema(description = "客户端的重定向URI,可为空")
    @TableField(value = "web_server_redirect_uri")
    private String webServerRedirectUri;

    @Schema(description = "客户端所拥有的Spring Security的权限")
    @TableField(value = "authorities")
    private String authorities;

    @Schema(description = "客户端的access_token的有效时间")
    @TableField(value = "access_token_validity")
    private Integer accessTokenValidity;

    @Schema(description = "客户端的refresh_token的有效时间")
    @TableField(value = "refresh_token_validity")
    private Integer refreshTokenValidity;

    @Schema(description = "客户端的一些其他信息")
    @TableField(value = "additional_information")
    private String additionalInformation;

    @Schema(description = "是否自动Approval操作")
    @TableField(value = "autoapprove")
    private String autoapprove;

    @Schema(description = "创建时间")
    @TableField(value = "create_time")
    private LocalDateTime createTime;

}
